import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] arr = new int[n];
        int target = in.nextInt(); // 待查找的数字
        // 录入数组
        for (int i = 0; i < n; i++) {
            arr[i] = in.nextInt();
        }
        // 二分
        int left = 0;
        int right = arr.length - 1;
        int ret = -1; // 返回结果
        while (left < right) {
            int mid = (left + right) / 2;
            if (arr[mid] > target) {
                right = mid - 1;
            } else if (arr[mid] < target) {
                left = mid + 1;
            } else {
                ret = mid;
                break;
            }
        }
//        // 找到最小的索引
//        while (ret > 0 && arr[ret] == target) {
//            ret--;
//        }
//        ret = ret == -1 ? -1 : ret + 1;
        System.out.println(ret);
        in.close();
    }
}